home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10697 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: in1.uu.net!interaccess!usenet
  2. From: brianmcg@interaccess.com (Brian V. McGroarty)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: a typedef question
  5. Date: 19 Mar 1996 14:47:51 GMT
  6. Organization: Internet Squire
  7. Message-ID: <4imhen$12b@nntp.interaccess.com>
  8. References: <4ilq55$4oo@newserv.ksu.ksu.edu>
  9. Reply-To: brianmcg@interaccess.com
  10. NNTP-Posting-Host: d46-isdn.nhe.interaccess.com
  11. X-Newsreader: Internet Squire 1.20
  12.  
  13. Since struct A would contain B and B would contain A, you would have an
  14. infinitely large structure!  Depending on what you are trying to do, you
  15. may want instead to include a pointer to the other structure instead of a
  16. copy of the actual structure, or you may want to make another structure
  17. which contains one of each of the other structures.
  18.  
  19.  
  20.  
  21. Bin Chen wrote:
  22. >Here is the question:
  23.  
  24. >        typedef struct A {
  25. >                ......
  26. >                struct B one_attr;
  27. >                ......
  28. >        };
  29.  
  30. >        typedef struct B {
  31. >                ......
  32. >                struct A two_attr;
  33. >                ......
  34. >        };
  35.  
  36. >Is this OK? How do you make it correct if it is not right?
  37.  
  38.  
  39. ---
  40. Brian Valters McGroarty -- brianmcg@bix.com
  41. phone/fax (847) 439-7714
  42.  
  43.  
  44.